package com.bbg.amyam.domain.model;

import java.util.Date;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooJpaActiveRecord(finders = { "findRegistrationsByStudent", "findRegistrationsByCourse" })
public class Registration {

    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "SS")
    private Date registrationDate;

    @NotNull
    @ManyToOne(fetch = FetchType.LAZY)
    private Student student;

    @NotNull
    @ManyToOne(fetch = FetchType.LAZY)
    private Course course;

    @NotNull
    @ManyToOne
    private Profile registedBy;

    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "SS")
    private Date confirmedDate;

    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "SS")
    private Date cancelledDate;
}
